<template>
  <component :is="currentRole" />
</template>

<script>
import { defineComponent, ref } from 'vue'
import { useStore } from 'vuex'
import adminDashboard from './admin'
import editorDashboard from './editor'

export default defineComponent({
  naem: 'Dashboard',
  components: {
    adminDashboard,
    editorDashboard,
  },
  setup() {
    const currentRole = ref('adminDashboard')
    const roles = useStore().getters.roles

    if (!roles.includes('admin')) {
      currentRole.value = 'editorDashboard'
    }
    // console.log(roles.includes('admin'))
    return {
      currentRole,
    }
  },
})
</script>

<style lang="scss" scoped></style>
